# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-wikipedia
pkgname=('python2-wikipedia' 'python-wikipedia')
_pkgname=wikipedia
pkgver=1.4.0
pkgrel=6
pkgdesc='Wikipedia API for Python.'
arch=('any')
url='https://pypi.org/project/wikipedia/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('56d3382c784fd16205edc5b6f34a8bac5b6fefc21856993413ba339e9e9016b9b65602ed8eaeb1fe593f8eafc6b7b049dba14427cf08e08aabc03fd971504418')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-wikipedia() {
  depends=('python2' 'python2-beautifulsoup4' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-wikipedia() {
  depends=('python' 'python-beautifulsoup4' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

